// pages/clinicQuery/clinicQueryDetail.js
const api = require('../../utils/api')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    listData: [],
    applyDeptname: '',
    applyNo: '',
    execDeptname: '',
    execTime: '',
    applyItemName: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.data.applyDeptname = options.applyDeptname
    this.data.applyNo = options.applyNo
    this.data.execDeptname = options.execDeptname
    this.data.execTime = options.execTime
    this.data.applyItemName = options.applyItemName
    this.setData({
      applyDeptname: this.data.applyDeptname,
      applyNo: this.data.applyNo,
      execDeptname: this.data.execDeptname,
      execTime: this.data.execTime,
      applyItemName: this.data.applyItemName
    })
    let that = this
    api.getApplyResult(this.data.applyNo).then(res=>{
      that.data.listData.splice(0,that.data.listData.length);
      res.forEach(r=>{
        that.data.listData.push({
          name: r.itemName,
          value: r.itemQualitative,
          limit: r.itemReference,
          unit: r.itemUnit
        })
      })
      that.setData({
        listData: that.data.listData
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})